import React, { Component } from 'react'
// as 表示起别名
import {BrowserRouter as Router,NavLink,Switch,Redirect,Route} from "react-router-dom"
import A from "./a"
import B from "./b"
import { Tabbar } from 'react-vant';
import { FriendsO, HomeO, Search, SettingO } from '@react-vant/icons';
// 快捷键 imbrc import { Route, Switch, NavLink, Link } from 'react-router-dom'
// BrowserRouter 路由管理的文件都要用BrowserRouter包起来
// NavLink 是跳转路由链接得 
// Switch 是保证路由得唯一性的
// Redirect 路由重定向
// 每一个route都相当于vue里的router-view
 class All extends Component {
  render() {
    return (
        <Router>
            <Switch>
               <Route path="/a" component={A}></Route>
               <Route path="/b" component={B}></Route>
               {/* redirect 必须写在最下面 */}
               <Redirect from="/" to="/a"></Redirect>
            </Switch>
           
           
            <Tabbar>
                <Tabbar.Item icon={<HomeO />}>
                    <NavLink to="/a">去a</NavLink>
                </Tabbar.Item>
                <Tabbar.Item icon={<Search />}>
                    <NavLink to="/b">去b</NavLink>
                </Tabbar.Item>
    
            </Tabbar>
        </Router>
    )
  }
}

export default All